package yf.mall.entity;


import lombok.Setter;
import lombok.Getter;
import yf.mall.vo.ItemVo;

import java.io.Serializable;
import java.util.Date;

import java.math.BigDecimal;

/**
 * 订单详情实体
 * 表名 order_item
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Sun May 24 14:16:14 CST 2020
 */
@Setter
@Getter
public class OrderItemEntity extends ItemVo implements Serializable {
    private static final long serialVersionUID = 1L;

    //
    private Long id;
        //订单ID
    private Long orderId;
        //产品ID
    private Long goodsId;
        //规格名称
    private String skuName;
        //产品名
    private String name;
        //产品价格
    private BigDecimal price;
        //产品重量
    private BigDecimal weight;
        //产品图
    private String img;
        //数量
    private Integer quantity;
        //必需积分
    private BigDecimal point;
        //最高可用优惠券
    private BigDecimal coupon;
        //最高可用换购券
    private BigDecimal voucher;
    //最高可用换购券
    private BigDecimal clear;
    //ENUM-是否评论:"NO- 否","YES-是"
    private Integer status;

    public OrderItemEntity(){

    }

    public OrderItemEntity(Long orderId,
                           Long goodsId,
                           String skuName,
                           String name,
                           BigDecimal price,
                           BigDecimal weight,
                           String img,
                           Integer quantity,
                           BigDecimal point,
                           BigDecimal coupon,
                           BigDecimal voucher,
                           BigDecimal clear) {
        this.orderId = orderId;
        this.goodsId = goodsId;
        this.skuName = skuName;
        this.name = name;
        this.price = price;
        this.weight = weight;
        this.img = img;
        this.quantity = quantity;
        this.point = point;
        this.coupon = coupon;
        this.voucher = voucher;
        this.voucher = voucher;
        this.clear = clear;
    }

    public BigDecimal getTotalPrice() {
        return this.price.multiply(new BigDecimal(this.quantity));
    }

    public BigDecimal getTotalPoint() {
        if (point == null) {
            return BigDecimal.ZERO;
        }
        return this.point.multiply(new BigDecimal(quantity));
    }
    public BigDecimal getTotalVoucher() {
        if (voucher == null) {
            return BigDecimal.ZERO;
        }
        return this.voucher.multiply(new BigDecimal(quantity));
    }

    public BigDecimal getTotalCoupon() {
        if (coupon == null) {
            return BigDecimal.ZERO;
        }
        return coupon.multiply(new BigDecimal(quantity));
    }
    public BigDecimal getTotalClear() {
        if (clear == null) {
            return BigDecimal.ZERO;
        }
        return this.clear.multiply(new BigDecimal(quantity));
    }


}


